import { defHttp } from '/@/utils/http/axios'
import { LoginParams, LoginResultModel, GetUserInfoModel } from './model/userModel'

import { ErrorMessageMode } from '/#/axios'
import { request } from '/@/utils/http/axios'

enum Api {
  Login = '/login',
  Logout = '/sysAuthAbout/logoutCurrent',
  GetPermCode = '/getPermCode',
}



// 登录
export const loginApi = params => {
  return request({
    url: '/sysAuthAbout/login',
    method: 'POST',
    params,
  })
}



/**
 * 获取系统年份
 * */

export const getsysYear = params => {
  return request({
    url: "/sysCommon/getSysYear",
    method: "GET",
    params
  })
}


/**
 * 机读卡校验登录
 * @param {object} params 请求参数
 * @returns
 */
export const simpleLogin = params => {
  return request({
    url: '/sys/simpleLogin',
    method: 'get',
    params,
  })
}



/**
 * 获取验证图片
 * @param params
 * @returns
 */
export const loginCode = params => {
  return request({
    url: '/sysCommon/generatorWebVerifyCode',
    method: 'GET',
    params,
  })
}



export function getPermCode() {
  return defHttp.get<string[]>({ url: Api.GetPermCode })
}

export function doLogout() {
  return defHttp.post({ url: Api.Logout })
}

/**
 * 修改密码
 * @param info
 * @returns
 */
export function changePassword(info) {
  return defHttp.post({
    url: '/sysAuthAbout/updatePwd',
    data: info,
  })
}
